/**
 * Attach cdn url to relative path of resources
 * @param path relative path of resources
 */
function cdn (path: string) {
  if (!path || path === '') return '/static/placeholder.png'

  const reg = /^((ht|f)tps?):\/\//
  return reg.test(path)
    ? path
    : process.env.VUE_APP_CDN_URL + path
}

export { cdn }
